package junit.com.cpi.cornpp.common.files;

import java.util.List;

import junit.framework.TestCase;

import com.cpi.cornpp.common.files.SAPComponentCornFactor;
import com.cpi.cornpp.common.files.exception.SAPComponentFileException;

public class SAPComponentCornFactorTest extends TestCase {
	
	private static final String FILE_NAME = "CornFactors.txt";
	//private static final int OFF_SET_LINES = 1;
	SAPComponentCornFactor  sapComponentCornFactor = null;
	
	public SAPComponentCornFactorTest(String name) {
		super(name);
	}
	
	protected void setUp() throws Exception {
		sapComponentCornFactor = new SAPComponentCornFactor(FILE_NAME);
	}
	
	protected void tearDown() throws Exception {
		sapComponentCornFactor = null;
	}
	
	public void testParse() {
		List fileLines = null;
		List fileDTOs = null;
		int totalFile = 0;
		int totalImported = 0;
		try {
			if(sapComponentCornFactor.exists()){
				fileLines = sapComponentCornFactor.getContent();
				totalFile = fileLines.size();
				fileDTOs = sapComponentCornFactor.parse(fileLines);
				totalImported = sapComponentCornFactor.insertAll(fileDTOs);
				System.out.println("Summary-> total: " + totalFile + " ; imported : "+ totalImported);
			}
		} catch (SAPComponentFileException e) {
			e.printStackTrace();
			fail(e.getMessage());
		}
	}

	public void testInsertAll() {
		fail("Not yet implemented");
	}

	public void testSAPComponentFile() {
		fail("Not yet implemented");
	}

	public void testExists() {
		fail("Not yet implemented");
	}

	public void testGetContent() {
		fail("Not yet implemented");
	}

}
